{==============================================================================}
{  Acroprise Multi-Language Components                                         }
{                                                                              }
{  Copyright (C), 1999-2012, Acroprise Inc.                                    }
{  http://www.acroprise.com.tw                                                 }
{  ALL RIGHTS RESERVED                                                         }
{                                                                              }
{  Author   : Mustapha.Wang                                                    }
{  Version  : 4.1.15.2159                                                      }
{  Creation : 2002/05/06                                                       }
{  Revision :                                                                  }
{  Task     :                                                                  }
{==============================================================================}
unit acroMultiLib_vcl;
{$I acroMultiLang.Inc}
interface
uses
  Classes,SysUtils,
  {$IFNDEF Delphi15High}
  Stdctrls,ComCtrls,
  {$ELSE}
  vcl.Stdctrls,vcl.ComCtrls,
  {$ENDIF}
  acroMultiDD,
  {$IFDEF UNICODE}
  acroCulture_Unicode,
  {$ELSE}
  acroCulture_Ansi,
  {$ENDIF}
  acroMultiLib,acroMultiClassMethod,
  acroMultiResource,acroMultiScreen;

  procedure FillCultureToComboBox(AComboBox:TCustomComboBox;ASupportedLCIDList:TStrings;
            AMustIncludeEnglish:Boolean;ADD:TCustomMultiDD;ALCID:string;ASeqNo:string);
  procedure DumpClassMethodToTree(ATree:TCustomTreeView);

implementation

type
  TCustomComboBox_Temp=class(TCustomComboBox);
  TCustomTreeView_Temp=class(TCustomTreeView);

procedure FillCultureToComboBox(AComboBox:TCustomComboBox;
  ASupportedLCIDList:TStrings;AMustIncludeEnglish:Boolean;ADD:TCustomMultiDD;ALCID:string;ASeqNo:string);
var
  i:integer;
  vOldOnChange:TNotifyEvent;
  vCulture:TacroCultureInfo;
begin
  vOldOnChange:=TCustomComboBox_Temp(AComboBox).OnChange;
  TCustomComboBox_Temp(AComboBox).OnChange:=nil;
  try
    TCustomComboBox_Temp(AComboBox).Clear;
    FillCultureToList(TCustomComboBox_Temp(AComboBox).Items,ASupportedLCIDList,AMustIncludeEnglish,ADD,ALCID,ASeqNo);
    for i := 0 to TCustomComboBox_Temp(AComboBox).Items.Count-1 do
    begin
      vCulture:=PacroCultureInfo(TCustomComboBox_Temp(AComboBox).Items.Objects[i])^;
      if InttoStr(vCulture.LCID)=ALCID then
      begin
        AComboBox.ItemIndex:=i;
        break;
      end;
    end;
  finally
    TCustomComboBox_Temp(AComboBox).OnChange:=vOldOnChange;
  end;
end;

procedure DumpClassMethodToTree(ATree: TCustomTreeView);
  procedure CreateNode(AParent:TTreeNode;ACM:TClassMethod);
  var
    ANode:TTreeNode;
  begin
    ANode:=TCustomTreeView_Temp(ATree).Items.AddChild(AParent,ACM.MLClass.ClassName);
    if ACM.Son<>nil then CreateNode(ANode,ACM.Son);
    if ACM.Brother<>nil then CreateNode(AParent,ACM.Brother);
  end;
var
  i:integer;
begin
  TCustomTreeView_Temp(ATree).Items.BeginUpdate;
  try
    TCustomTreeView_Temp(ATree).Items.Clear;
    for i:=0 to acroClassMethodStorage.Count-1 do
    begin
      CreateNode(nil,TClassMethod(acroClassMethodStorage.Items[i]));
    end;
  finally
    TCustomTreeView_Temp(ATree).Items.EndUpdate;
  end;
end;

end.
